<?php
date_default_timezone_set('PRC');
include_once("../excel/excel.php");
include_once("./Db_pdo.class.php");
//添加 刷手页面
echo '<pre>';
$DB=new Db_pdo("aisiqu","root","root");


$s = new excel();
$data = $s->dtext("fish.xlsx");
foreach ($data as $key => $value) {
	if($value['0']){
		$arr[]= $value;
	}
}

// print_r($arr);

//门票的流水（单）


$arr1 = array_chunk($arr, 500);
foreach($arr1 as $v) {

$sql = "INSERT INTO aq_buyer (`wx`,`sex`,`account`,`create_at`) VALUES ";

	foreach ($v as $value) { 
		//print_r($value);
		$count = $DB->table('aq_buyer')->where("account='".$value['2']."'")->selectRows(); 
		if($count >0){
			continue;
		}
		$sql1 = '';
		$param['wx'] = $value['0'];
		if($value['1']=='男'){
		 	$param['sex'] = 1;
		}else{
		 	$param['sex'] = 2;
		}
		 
		$param['account'] = $value['2'];
		$param['create_at'] = date('Y-m-d H:i:s',time());
		
	 	$values="('".implode("','",array_values($param))."'),";
	 
	 	$sql .= $values;

	}
	$sql = rtrim($sql, ",");
	
	//$DB->db->query($sql);
	
}




?>